package com.haizhi.crm.common.config;

import com.arangodb.ArangoDB;
import com.arangodb.ArangoDatabase;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ArangodbConfig {

    @Value("${arangodb.host}")
    private String host;

    @Value("${arangodb.pot}")
    private String pot;

    @Value("${arangodb.username}")
    private String username;

    @Value("${arangodb.password}")
    private String password;

    @Value("${arangodb.dbname}")
    private String dbname;

    @Bean
    public ArangoDatabase arangoDatabase() {
        ArangoDatabase db = new ArangoDB.Builder()
                .host(this.host, Integer.valueOf(this.pot))
                .user(this.username)
                .password(this.password)
                .build()
                .db(this.dbname);
        return db;
    }


}
